<% include ../inc/head.ejs%>
<div class="container">

    <div class="col-md-8">
        <ul class="list-group">
        <% data.forEach(function(item){%>
            <li class="list-group-item article-list">
                <h4><a href="/articles/details/<%=item._id%>"><%=item.title.substr(0,20)%></a>
                    <% if(session_user!='') {%>
                    <% if(item.user_id._id==session_user._id) {%>
                    <a href="/articles/edit/<%=item._id%>/<%=item.pic?item.pic:0%>/<%=item.user_id._id%>" class="btn btn-sm btn-warning">编辑</a> <a href="/articles/del/<%=item._id%>/<%=item.cat_id%>/<%=item.pic?item.pic:0%>/<%=item.user_id._id%>" class="btn btn-sm btn-danger">删除</a>
                    <%}}%>
                </h4>
                <h5><i class="glyphicon glyphicon-dashboard"></i> <span><%=FormatDate(item.addtime)%></span>  <i class="glyphicon glyphicon-user"></i> <span><%=item.user_id.username%></span>  <i class="glyphicon glyphicon-list"></i> <span><%=item.cat_name%></span></h5>
                <div class="row">
                    <div class="col-md-4">
                        <% if(item.pic){ %>
                        <img src="/<%=item.pic%>" alt="<%=item.title%>" class="img-responsive">
                        <%}else{%>
                        <img src="/images/bj.png" alt="无缩略图" class="img-responsive" style="border:1px solid #ccc;">
                        <%}%>
                    </div>
                    <div class="col-md-8">
                        <div ><%=item.intro%></div>
                    </div>
                <div class="clearfix"></div>
                    <div class="pull-right readall"><a href="/articles/details/<%=item._id%>">阅读全文(<%=item.pv%>)</a></div>
                </div>
                <div class="clearfix"></div>
            </li>
            <%})%>
        </ul>
    </div>
    <div class="col-md-4">
        <% include ../inc/right.ejs%>
    </div>
</div>
<% include ../inc/footer.ejs%>